﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using DatingWebSite.DatingService;
 

namespace DatingWebSite.Pages
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            try
            {
                int memberID = Common.Common.AuthenticateMember(txtUserName.Text.Trim(), txtPassword.Text.Trim(),
                    Convert.ToInt32(Session["TenentID"]), Session["SecureKey"].ToString());
                if (memberID <= 0)
                    lblErrMessage.Text = "Invalid UserID Password!!!";
                else
                {
                    Session.Add("LoggedIn", "True");
                    Session.Add("MemberProfileID", memberID.ToString());
                    Session.Add("UserName", txtUserName.Text.Trim());
                    Response.Redirect("profile.aspx");
                }
            }
            catch
            {
                lblErrMessage.Text = "There was error in contacting system. Please try again later.";
            } 
        }
    }
}
